#pragma once

public value struct PointV
{
private:
	int x;
	int y;
public:
	// must not 
	//PointV(){}
	PointV(int _x, int _y): x(_x), y(_y) {}
	// can not contain 
	//~PointV(){}
	// a finalizer can only be a member of a reference type
	//!PointV(){}
	void PrintPt()
	{
		System::Console::WriteLine("(X:{0},Y:{1})",x,y);
	}
};

public value class LineV
{
private:
    PointV m_ptStart;
    PointV m_ptEnd;
public :
    LineV(PointV start,PointV end)
    {
        m_ptStart = start;
        m_ptEnd = end;
    }
	// can not contain 
	//~LineV(){}
	// a finalizer can only be a member of a reference type
	//!LineV(){}
	void PrintLine()
	{
		System::Console::Write("StartPoint:");
		m_ptStart.PrintPt();
		System::Console::Write("EndPoint:");
		m_ptEnd.PrintPt();
	}
}; 

void Test2()
{
	PointV pt(10,10);
	pt.PrintPt();
	PointV* pPt = new PointV(100,100);
	pPt->PrintPt();
	delete pPt;
	PointV^ rPt = gcnew PointV(1,1);
	rPt->PrintPt();
	// you can delete it or not
	delete rPt;
	
	LineV line(PointV(30,30), PointV(40,40));
	line.PrintLine();
	LineV* pLine = new LineV(PointV(300,300), PointV(400,400));
	pLine->PrintLine();
	delete pLine;
	LineV^ rLine = gcnew LineV(PointV(3,3), PointV(4,4));
	rLine->PrintLine();
	// you can delete it or not
	delete rLine;
}